<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>LOGIN</title>
</head>
<body>
<h1>登录</h1>
<form action="javascript:0;">
    <input id="url" th:value="${url}" type="hidden">
    <input id="param" th:value="${param}" type="hidden">
    <label>
        <span>NAME</span> <input id="username" name="username" type="text">
    </label>
    <label>
        <span>PASSWORD</span><input id="password" name="password" type="password">
    </label>
    <button>click</button>
</form>
</body>
<script src="https://www.jq22.com/jquery/jquery-3.3.1.js"></script>
<script>
    $("button").click(function () {
        let bean = {
            username: $("#username").val(),
            password: $("#password").val(),
        }
        console.log(bean)
        $.ajax({
            type: 'POST',
            url: "/login",
            data: bean,
            /*登录成功 浏览器跳转到指定的地址 并携带token*/
            success: (res) => {
                window.location.href = $("#url").val() + "?token=" + res;
            }
        })
    });
</script>
</html>